﻿package mortal.game.view.petNew.view
{
    import Message.DB.Tables.*;
    import Message.Public.*;
    import baseEngine.modifiers.*;
    import baseEngine.system.*;
    import com.gengine.core.frame.*;
    import com.gengine.global.*;
    import com.gengine.resource.*;
    import com.gengine.utils.*;
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.greensock.layout.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.manager.*;
    import com.mui.utils.*;
    import extend.language.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.utils.*;
    import frEngine.effectEditTool.temple.*;
    import frEngine.pools.*;
    import frEngine.primitives.object2d.*;
    import mortal.common.*;
    import mortal.common.display.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.component.rotate3dModelSprite.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.cache.packCache.*;
    import mortal.game.manager.*;
    import mortal.game.manager.window3d.*;
    import mortal.game.model.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.model.data.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.model.pools.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.shop.*;
    import mortal.game.view.vip.*;
    import mortal.mvc.core.*;

    public class PetInfoPanel extends NewPetPanelBase
    {
        private var _lBg:GBitmap;
        private var _levelUpIcon:GBitmap;
        protected var _combatBg:GImageBitmap;
        private var _equipPart:PetInfoEpuipPanel;
        private var _petSkillPart:NewPetSkillPanel;
        private var _rightInfo:PetInfoRightInfoView;
        protected var _beforeAdvance:GImageBitmap;
        protected var _afterAdvance:GImageBitmap;
        protected var _currLevelName:GTextFiled;
        protected var _nextLevelName:GTextFiled;
        private var _vipSp:ToolTipSprite;
        private var _vipIcon:GImageBitmap;
        protected var _turnLeftBtn:GLoadedButton;
        protected var _turnRightBtn:GLoadedButton;
        private var _sharpBtn:GLoadingButton;
        protected var _fashionName:GTextFiled;
        private var _isRightTop:Boolean;
        private var _tmountInfo:TMountConfig;
        private var _currentIndex:int;
        private var _typePet:int = 100;
        private var _3dRotationSp:GSprite;
        private var _3dRotationBm:GBitmap;
        private var _leftBtn:GLoadedButton;
        private var _rightBtn:GLoadedButton;
        private var _rotate3d:Rotate3dModelSprite;
        private var _modelX:Number;
        private var _img2d:Img2D;
        private var _rect3d:Rect3DObject;
        private var _bodyPlayer:ActionPlayer;
        private var _flyHei:int = 185;
        protected var _mountHangEffect:EffectPlayer;
        protected var _nextMountHangEffect:EffectPlayer;
        private var _timeoutNum:uint;
        private var _isRecCompl:Boolean;
        private var _isMouseOver:Boolean;
        private var _mx:int = 11;
        private var _my:int = 38;
        private var _wid:int = 490;
        private var _hei:int = 546;
        private var _frameTimer:FrameTimer;
        private var _startX:Number;
        private var _endX:Number;
        private var turnValue:int;
        private var _tween1:TweenMax;
        private var _tween2:TweenMax;
        private var _bodyPlayer2:ActionPlayer;
        public static var isShowNow:Boolean = false;

        public function PetInfoPanel(param1:Window)
        {
            super(param1);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._3dRotationSp = UICompomentPool.getUICompoment(GSprite);
            this._3dRotationSp.x = 18;
            this._3dRotationSp.y = 35;
            this._3dRotationSp.mouseEnabled = true;
            _window.contentTopOf3DSprite.addChild(this._3dRotationSp);
            this._3dRotationBm = GlobalClass.getBitmap(BitmapDataConst.AlphaBMD);
            this._3dRotationBm.width = 485;
            this._3dRotationBm.height = 440;
            this._3dRotationSp.addChild(this._3dRotationBm);
            pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.mountTitleBg, 7, 33, _window.contentTopOf3DSprite));
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.size = 16;
            _loc_1.align = AlignMode.CENTER;
            this._fashionName = UIFactory.gTextField("" + Language.getString(71755), 208 - 83 + 5, 42 - 2, 243, 30, _window.contentTopOf3DSprite, _loc_1);
            this._turnLeftBtn = UIFactory.gLoadedButton(ImagesConst.MountLeft_upSkin, 61, 34, 33, 37, _window.contentTopOf3DSprite);
            this._turnRightBtn = UIFactory.gLoadedButton(ImagesConst.MountRight_upSkin, 409, 34, 33, 37, _window.contentTopOf3DSprite);
            this._vipSp = UICompomentPool.getUICompoment(ToolTipSprite);
            this._vipSp.x = 35;
            this._vipSp.y = 80;
            this._vipSp.toolTipData = this.getVipToolTip(false);
            _window.contentTopOf3DSprite.addChild(this._vipSp);
            this._vipSp.configEventListener(MouseEvent.ROLL_OVER, this.showEffect);
            this._vipSp.configEventListener(MouseEvent.ROLL_OUT, this.hideEffect);
            this._vipIcon = UIFactory.gImageBitmap("", 0, 0, this._vipSp);
            this._vipIcon.imgUrl = GameDefConfig.instance.getVipLevelIconUrl(VipUtil.getVipMinLevelByType(EVipRecordType._EVipRecordTypePetEffect), 2);
            this._sharpBtn = UIFactory.gLoadingButton(ResFileConst.TurnedBtn, 425, 80, 49, 52, _window.contentTopOf3DSprite);
            this._sharpBtn.visible = false;
            this._sharpBtn.drawNow();
            this._sharpBtn.configEventListener(MouseEvent.CLICK, this.onChangeClick);
            this._beforeAdvance = UIFactory.gImageBitmap(ImagesConst.BeforeAdvance, 6, 170, _window.contentTopOf3DSprite);
            this._beforeAdvance.visible = false;
            this._afterAdvance = UIFactory.gImageBitmap(ImagesConst.AfterAdvance, 415, 170, _window.contentTopOf3DSprite);
            this._afterAdvance.visible = false;
            this._currLevelName = UIFactory.gTextField("", 34 + 2, 240, 30, 188, _window.contentTopOf3DSprite, GlobalStyle.textFormatBai.setSize(21));
            this._currLevelName.multiline = true;
            this._currLevelName.wordWrap = true;
            this._currLevelName.textColor = 16775623;
            this._currLevelName.visible = false;
            this._nextLevelName = UIFactory.gTextField("", 442 + 2, 240, 30, 188, _window.contentTopOf3DSprite, GlobalStyle.textFormatBai.setSize(21));
            this._nextLevelName.multiline = true;
            this._nextLevelName.wordWrap = true;
            this._nextLevelName.textColor = 16775623;
            this._nextLevelName.visible = false;
            this._rightInfo = UICompomentPool.getUICompoment(PetInfoRightInfoView, _window);
            this._rightInfo.setOverAndOutFun(this.onMouseOver, this.onMouseOut);
            UIFactory.setObjAttri(this._rightInfo, 504, 37, -1, -1, _window.contentTopOf3DSprite);
            LoaderHelp.addResCallBack(ResFileConst.petInfo, this.onRecCompl);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            NetDispatcher.removeCmdListener(ServerCommand.PetAdvanceSucceed, this.onPetAdvanceSucceed);
            LoaderHelp.removeResEvent(ResFileConst.petInfo, this.onRecCompl);
            isShowNow = false;
            this._3dRotationBm = null;
            this._3dRotationSp = null;
            if (this._rect3d)
            {
                this._img2d = null;
                if (this._bodyPlayer)
                {
                    this._rect3d.disposeObj3d(this._bodyPlayer);
                }
                if (this._bodyPlayer2)
                {
                    this._rect3d.disposeObj3d(this._bodyPlayer2);
                }
                if (this._mountHangEffect)
                {
                    this._mountHangEffect.dispose(param1);
                    this._mountHangEffect = null;
                }
                if (this._nextMountHangEffect)
                {
                    this._nextMountHangEffect.dispose(param1);
                    this._nextMountHangEffect = null;
                }
                Rect3DManager.instance.disposeRect3d(this._rect3d);
                this._rect3d = null;
                this._bodyPlayer = null;
                this._bodyPlayer2 = null;
            }
            this._vipIcon = null;
            this._vipSp = null;
            this._leftBtn = null;
            this._rightBtn = null;
            this._tmountInfo = null;
            _pet = null;
            this._isRecCompl = false;
            this._isMouseOver = false;
            this._petSkillPart = null;
            this._beforeAdvance = null;
            this._afterAdvance = null;
            if (BuyGiftItemWin.isViewShow)
            {
                BuyGiftItemWin.instance.hide();
            }
            this._lBg = null;
            this._levelUpIcon = null;
            this._rightInfo = null;
            this._rotate3d = null;
            this._combatBg = null;
            this._equipPart = null;
            this._fashionName = null;
            this._turnLeftBtn = null;
            this._turnRightBtn = null;
            this._currLevelName = null;
            this._nextLevelName = null;
            this._sharpBtn = null;
            return;
        }// end function

        private function showEffect(event:MouseEvent) : void
        {
            if (!VipConfig.instance.isShowEffect(EVipRecordType._EVipRecordTypePetEffect, Cache.instance.vip.level))
            {
                this.addMountEffect();
            }
            return;
        }// end function

        private function hideEffect(event:MouseEvent) : void
        {
            if (!VipConfig.instance.isShowEffect(EVipRecordType._EVipRecordTypePetEffect, Cache.instance.vip.level))
            {
                if (this._mountHangEffect)
                {
                    this._rect3d.disposeObj3d(this._mountHangEffect);
                    this._mountHangEffect = null;
                }
            }
            return;
        }// end function

        public function updateVip() : void
        {
            var _loc_1:* = VipConfig.instance.getValueByTypeAndLv(EVipRecordType._EVipRecordTypePetEffect, Cache.instance.vip.level);
            var _loc_2:* = VipUtil.getVipMinLevelByType(EVipRecordType._EVipRecordTypePetEffect);
            if (Cache.instance.vip.level >= _loc_2)
            {
                this._vipIcon.filters = [];
                this._vipIcon.imgUrl = GameDefConfig.instance.getVipLevelIconUrl(Cache.instance.vip.level, 2);
                this.updatePetInfo();
                this._vipSp.toolTipData = this.getVipToolTip(true);
            }
            else
            {
                this._vipIcon.filters = [FilterConst.colorFilter2];
                this._vipIcon.imgUrl = GameDefConfig.instance.getVipLevelIconUrl(_loc_2, 2);
                this._vipSp.toolTipData = this.getVipToolTip(false);
            }
            return;
        }// end function

        private function getVipToolTip(param1:Boolean) : String
        {
            var _loc_2:* = VipConfig.instance.getVipConfigByType(EVipRecordType._EVipRecordTypePetEffect);
            var _loc_3:* = VipUtil.getVipMinLevelByType(EVipRecordType._EVipRecordTypePetEffect);
            var _loc_4:* = Language.getStringByParam(71756, _loc_3, HTMLUtil.addColor(_loc_2.desc, "#00ff00"));
            if (param1)
            {
                _loc_4 = Language.getStringByParam(71757, _loc_3, HTMLUtil.addColor(_loc_2.desc, "#00ff00"));
            }
            return _loc_4;
        }// end function

        protected function onClickTurnBtn(event:MouseEvent) : void
        {
            if (this._bodyPlayer)
            {
                if (event.currentTarget == this._leftBtn)
                {
                    this.turnValue = 2;
                }
                if (event.currentTarget == this._rightBtn)
                {
                    this.turnValue = -2;
                }
                this.start();
            }
            return;
        }// end function

        protected function stopTurning(event:MouseEvent = null) : void
        {
            if (this._frameTimer)
            {
                this._frameTimer.stop();
            }
            return;
        }// end function

        protected function onTurning(param1:FrameTimer) : void
        {
            if (this._bodyPlayer)
            {
                this._bodyPlayer.rotationY = this._bodyPlayer.rotationY + this.turnValue;
            }
            return;
        }// end function

        private function start() : void
        {
            if (!this._frameTimer)
            {
                this._frameTimer = new FrameTimer(1, int.MAX_VALUE, true);
                this._frameTimer.addListener(TimerType.ENTERFRAME, this.onTurning);
            }
            this._frameTimer.start();
            return;
        }// end function

        private function startTurn(event:MouseEvent) : void
        {
            this._startX = this.mouseX;
            this._3dRotationSp.configEventListener(MouseEvent.MOUSE_MOVE, this.turning);
            return;
        }// end function

        private function stopTurn(event:MouseEvent) : void
        {
            this._3dRotationSp.removeEventListener(MouseEvent.MOUSE_MOVE, this.turning);
            return;
        }// end function

        private function turning(event:MouseEvent) : void
        {
            this._endX = this.mouseX;
            this._bodyPlayer.rotationY = this._bodyPlayer.rotationY - (this._endX - this._startX) / 3;
            this._startX = this._endX;
            return;
        }// end function

        private function updatePage(event:MouseEvent = null) : void
        {
            var _loc_2:int = 0;
            if (event.currentTarget == this._turnLeftBtn)
            {
                this._currentIndex = this._currentIndex == 1 ? (1) : ((this._currentIndex - 1));
            }
            else if (event.currentTarget == this._turnRightBtn)
            {
                _loc_2 = _pet.code;
                this._currentIndex = this._currentIndex == _loc_2 ? (_loc_2) : ((this._currentIndex + 1));
            }
            this._tmountInfo = this.getPetInfoByCode(this._currentIndex);
            this._fashionName.text = "" + this._tmountInfo.name;
            this._rightInfo.updateName(this._currentIndex);
            this.update3DPet();
            this.updatePageBtn();
            this.updateMountSelect();
            return;
        }// end function

        private function updatePageBtn() : void
        {
            this._turnLeftBtn.filterEnabled = this._currentIndex != 1;
            this._turnRightBtn.filterEnabled = this._currentIndex < _pet.code;
            return;
        }// end function

        public function updateMountSelect() : void
        {
            if (this._currentIndex == Cache.instance.newPet.getShowCode)
            {
                this._sharpBtn.enabled = false;
            }
            else
            {
                this._sharpBtn.enabled = true;
            }
            return;
        }// end function

        protected function onChangeClick(event:MouseEvent) : void
        {
            if (_pet.sharpId > 100)
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71758));
                return;
            }
            if (_pet.code >= 4)
            {
                GameProxy.pet.changeSharp(this._currentIndex);
            }
            else
            {
                MsgManager.showRollTipsMsg("" + Language.getString(71759));
            }
            return;
        }// end function

        private function hasCloth() : Boolean
        {
            var _loc_3:ItemData = null;
            var _loc_1:* = EPlayerItemPosType._EPlayerItemPosTypePet;
            var _loc_2:int = 4;
            var _loc_4:* = Cache.instance.pack.getPackChacheByPosType(_loc_1);
            if (_loc_4)
            {
                _loc_3 = _loc_4.getItemDataByType(_loc_2);
                if (_loc_3 && !ItemsUtil.isPrescriOutTime(_loc_3))
                {
                    return true;
                }
            }
            return false;
        }// end function

        protected function clearBtnState() : void
        {
            this._turnLeftBtn.filterEnabled = true;
            this._turnRightBtn.filterEnabled = true;
            this._isRightTop = false;
            this._sharpBtn.filterEnabled = true;
            return;
        }// end function

        private function setSkillInfo() : void
        {
            this._petSkillPart.updateSkillGrid();
            return;
        }// end function

        override public function updateMsg(param1:SPublicPet2) : void
        {
            super.updateMsg(param1);
            if (this._isRecCompl == false)
            {
                return;
            }
            this._rightInfo.updateMsg(_pet);
            if (_pet == null)
            {
                return;
            }
            this.init3DRect();
            this.updatePetInfo();
            this.update3DPet();
            this.setSkillInfo();
            this.updateLeftTopName();
            return;
        }// end function

        private function updateLeftTopName() : void
        {
            this._tmountInfo = this.getPetInfoByCode(_pet.code);
            this._fashionName.text = "" + this._tmountInfo.name;
            return;
        }// end function

        private function updatePetInfo() : void
        {
            this._currentIndex = Cache.instance.newPet.getShowCode;
            this._tmountInfo = this.getPetInfoByCode(this._currentIndex);
            this.updatePageBtn();
            this.updateMountSelect();
            this._sharpBtn.visible = _pet.code >= 4;
            return;
        }// end function

        private function getPetInfoByCode(param1:int) : TMountConfig
        {
            var _loc_2:* = MountConfig.instance.getFashionInfoByCode(EAdvanceComponentType._EAdvanceComponentTypePet, param1);
            return _loc_2;
        }// end function

        private function update3DPet(param1:Boolean = false) : void
        {
            var _loc_2:TMountConfig = null;
            var _loc_3:EntityModelInfo = null;
            var _loc_4:TModel = null;
            var _loc_5:String = null;
            var _loc_6:String = null;
            var _loc_7:Obj3dInfo = null;
            if (this._isRecCompl && _pet)
            {
                this._currentIndex = this._currentIndex <= 0 ? (1) : (this._currentIndex);
                _loc_2 = this.getPetInfoByCode(this._currentIndex);
                _loc_3 = PetUtil.getPetModel(1, _loc_2.modelId);
                _loc_4 = ModelConfig.instance.getInfoByCode(_loc_2.modelId);
                _loc_5 = _loc_3.mesh + ".md5mesh";
                _loc_6 = _loc_3.bone + ".skeleton";
                if (param1 == false && this._bodyPlayer && this._bodyPlayer.meshUrl == _loc_5 && this._bodyPlayer.animUrl == _loc_6)
                {
                    _loc_7 = this._rect3d.getMesh3dInfo(this._bodyPlayer);
                    this._modelX = 230 + _loc_7.offsetX + this._rect3d.rect.x - Global3D.scene.viewPort.width / 2 - Global3D.scene.viewPort.x;
                    return;
                }
                if (this._bodyPlayer)
                {
                    this._rect3d.disposeObj3d(this._bodyPlayer);
                }
                this._bodyPlayer = FrObjectPool.getObject(ActionPlayer, this);
                this._bodyPlayer.changeAction(ActionName.Stand);
                this._bodyPlayer.hangBoneName = BoneConst.MountHangModelBone;
                this._bodyPlayer.selectEnabled = true;
                this._bodyPlayer.play();
                this._bodyPlayer.setRotation(0, 0, 0);
                this._bodyPlayer.scaleValue = PetUtil.petScaleValue(_loc_3.proportion1) * 2;
                this._bodyPlayer.load(_loc_5, _loc_6, _loc_3.texture, this._rect3d.renderList);
                if (_loc_4.sortNum == 1)
                {
                    this._rect3d.addObject3d(this._bodyPlayer, 239, 327 + this._flyHei);
                }
                else
                {
                    this._rect3d.addObject3d(this._bodyPlayer, 239, 327);
                }
                this._modelX = this._bodyPlayer.x;
                this._rotate3d.model = this._bodyPlayer;
                if (VipConfig.instance.isShowEffect(EVipRecordType._EVipRecordTypeMountEffect, Cache.instance.vip.level))
                {
                    this.addMountEffect();
                }
            }
            return;
        }// end function

        private function addMountEffect() : void
        {
            var _loc_1:TMountConfig = null;
            var _loc_2:EntityModelInfo = null;
            if (this._rect3d && _pet)
            {
                this._currentIndex = this._currentIndex <= 0 ? (1) : (this._currentIndex);
                _loc_1 = this.getPetInfoByCode(this._currentIndex);
                _loc_2 = PetUtil.getPetModel(1, _loc_1.modelId);
                if (this._mountHangEffect)
                {
                    this._rect3d.disposeObj3d(this._mountHangEffect);
                    this._mountHangEffect = null;
                }
                if (_loc_2.effect)
                {
                    this._mountHangEffect = EffectPlayerPool.instance.getEffectPlayer(_loc_2.effect, this._bodyPlayer, this._rect3d.renderList, false);
                    if (this._mountHangEffect.temple is TempleRole)
                    {
                        (this._mountHangEffect.temple as TempleRole).setRoleParams(this._bodyPlayer, null, null);
                    }
                    this._mountHangEffect.play(PlayMode.ANIMATION_LOOP_MODE);
                }
            }
            return;
        }// end function

        private function add2d() : void
        {
            if (this.isDisposed)
            {
                return;
            }
            this._rect3d.removeImg(this._img2d);
            this._img2d = new Img2D(null, this._lBg.bitmapData, new Rectangle(0, 0, this._wid, this._hei), false);
            this._rect3d.addImg(this._img2d);
            this._turnRightBtn.configEventListener(MouseEvent.CLICK, this.updatePage);
            this._turnLeftBtn.configEventListener(MouseEvent.CLICK, this.updatePage);
            return;
        }// end function

        private function showNextPetModle() : void
        {
            var _loc_1:TMountConfig = null;
            var _loc_2:EntityModelInfo = null;
            var _loc_3:TModel = null;
            var _loc_4:String = null;
            var _loc_5:String = null;
            if (this._isRecCompl && this._isMouseOver && _pet)
            {
                _loc_1 = this.getPetInfoByCode((_pet.code + 1));
                if (_loc_1 == null)
                {
                    return;
                }
                _loc_2 = PetUtil.getPetModel(1, _loc_1.modelId);
                _loc_3 = ModelConfig.instance.getInfoByCode(_loc_1.modelId);
                _loc_4 = _loc_2.mesh + ".md5mesh";
                _loc_5 = _loc_2.bone + ".skeleton";
                if (this._bodyPlayer2)
                {
                    this._rect3d.disposeObj3d(this._bodyPlayer2);
                }
                this._bodyPlayer2 = FrObjectPool.getObject(ActionPlayer, this);
                this._bodyPlayer2.changeAction(ActionName.Stand);
                this._bodyPlayer2.hangBoneName = BoneConst.MountHangModelBone;
                this._bodyPlayer2.selectEnabled = true;
                this._bodyPlayer2.play();
                this._bodyPlayer2.alpha = 0;
                this._bodyPlayer2.scaleValue = PetUtil.petScaleValue(_loc_2.proportion1) * 2;
                this._bodyPlayer2.rotationY = 50;
                this._bodyPlayer2.load(_loc_4, _loc_5, _loc_2.texture, this._rect3d.renderList);
                if (_loc_3.sortNum == 1)
                {
                    this._rect3d.addObject3d(this._bodyPlayer2, 239, 327 + this._flyHei);
                }
                else
                {
                    this._rect3d.addObject3d(this._bodyPlayer2, 239, 327);
                }
                if (VipConfig.instance.isShowEffect(EVipRecordType._EVipRecordTypePetEffect, Cache.instance.vip.level))
                {
                    if (this._nextMountHangEffect)
                    {
                        this._nextMountHangEffect.dispose(true);
                        this._nextMountHangEffect = null;
                    }
                    if (_loc_2.effect)
                    {
                        this._nextMountHangEffect = EffectPlayerPool.instance.getEffectPlayer(_loc_2.effect, this._bodyPlayer2, this._rect3d.renderList, false);
                        if (this._nextMountHangEffect.temple is TempleRole)
                        {
                            (this._nextMountHangEffect.temple as TempleRole).setRoleParams(this._bodyPlayer2, null, null);
                        }
                        this._nextMountHangEffect.play(PlayMode.ANIMATION_LOOP_MODE);
                    }
                }
                if (this._bodyPlayer)
                {
                    this._bodyPlayer.rotationY = 50;
                    this._bodyPlayer.rotationY = this._bodyPlayer.rotationY % 360;
                    this._tween1 = TweenMax.to(this._bodyPlayer, 1, {x:this._modelX - 105, rotationY:-50, ease:Quint.easeOut});
                    this._tween2 = TweenMax.to(this._bodyPlayer2, 1, {x:this._modelX + 105, alpha:0.6, ease:Quint.easeOut});
                }
            }
            return;
        }// end function

        private function onMouseOver() : void
        {
            if (isDisposed)
            {
                return;
            }
            this._isMouseOver = true;
            if (this._levelUpIcon == null)
            {
                return;
            }
            this._levelUpIcon.visible = true;
            this.skillTween();
            this.showNextPetModle();
            this._beforeAdvance.visible = true;
            this._afterAdvance.visible = true;
            this._rightBtn.visible = false;
            this._leftBtn.visible = false;
            this._currLevelName.visible = true;
            this._currLevelName.text = _pet.name;
            var _loc_1:* = this.getPetInfoByCode((_pet.code + 1));
            if (_loc_1)
            {
                this._nextLevelName.visible = true;
                this._nextLevelName.text = _loc_1.name;
            }
            else
            {
                this._nextLevelName.visible = false;
            }
            TweenMax.to(this._equipPart, 1, {alpha:0, ease:Quint.easeOut});
            return;
        }// end function

        private function skillTween() : void
        {
            if (this._tween1 && this._tween2)
            {
                this._tween1.kill();
                this._tween2.kill();
                this._tween1 = null;
                this._tween2 = null;
            }
            return;
        }// end function

        private function onMouseOut() : void
        {
            this._isMouseOver = false;
            if (this._levelUpIcon == null)
            {
                return;
            }
            this._levelUpIcon.visible = false;
            this.skillTween();
            if (this._bodyPlayer)
            {
                this._tween1 = TweenMax.to(this._bodyPlayer, 0.6, {x:this._modelX, rotationY:0, ease:Quint.easeOut});
            }
            if (this._bodyPlayer2)
            {
                this._tween2 = TweenMax.to(this._bodyPlayer2, 0.6, {x:this._modelX, alpha:0.05, ease:Quint.easeOut, onComplete:this.onShowEnd});
            }
            TweenMax.to(this._equipPart, 1, {alpha:1, ease:Quint.easeOut});
            this._beforeAdvance.visible = false;
            this._afterAdvance.visible = false;
            this._currLevelName.visible = false;
            this._nextLevelName.visible = false;
            this._rightBtn.visible = true;
            this._leftBtn.visible = true;
            return;
        }// end function

        private function onShowEnd() : void
        {
            if (this._rect3d && this._bodyPlayer2)
            {
                this._rect3d.disposeObj3d(this._bodyPlayer2);
                this._bodyPlayer2 = null;
            }
            return;
        }// end function

        private function onPetAdvanceSucceed(param1:Object) : void
        {
            var time:uint;
            var onTimeout:Function;
            var obj:* = param1;
            onTimeout = function () : void
            {
                clearTimeout(time);
                onMouseOut();
                onMouseOver();
                return;
            }// end function
            ;
            if (this._isMouseOver)
            {
                time = setTimeout(onTimeout, 200);
            }
            return;
        }// end function

        private function onWindowDragEnd(event:Event) : void
        {
            this.update3DPet(true);
            return;
        }// end function

        private function onRecCompl() : void
        {
            this._isRecCompl = true;
            this._lBg = UIFactory.gBitmap("", 14, 35);
            this._combatBg = UIFactory.gImageBitmap(ImagesConst.PetInfoLeftBgNew, 145, 76, _window.contentTopOf3DSprite);
            _window.contentTopOf3DSprite.addChild(this._rightInfo);
            this._levelUpIcon = UIFactory.gBitmap("", 205, 277, _window.contentTopOf3DSprite);
            this._levelUpIcon.visible = false;
            this._rotate3d = UIFactory.getUICompoment(Rotate3dModelSprite, 18, 105, _window.contentTopOf3DSprite);
            this._rotate3d.setSize(480, 335);
            this._petSkillPart = UIFactory.getUICompoment(NewPetSkillPanel, 0, 0, _window.contentTopOf3DSprite);
            _window.addEventListener(EventName.WindowDragEnd, this.onWindowDragEnd);
            NetDispatcher.addCmdListener(ServerCommand.PetAdvanceSucceed, this.onPetAdvanceSucceed);
            this._timeoutNum = setTimeout(this.setTimeoutFun, 500);
            this._lBg.bitmapData = GlobalClass.getBitmapData(ImagesConst.PetInfoRightBg);
            this._levelUpIcon.bitmapData = GlobalClass.getBitmapData(ImagesConst.PetInfoLevelUpIcon);
            this.updateMsg(Cache.instance.newPet.pet);
            this.showNextPetModle();
            this.add2d();
            this._equipPart = UIFactory.getUICompoment(PetInfoEpuipPanel, 0, 0, _window.contentTopOf3DSprite);
            this._equipPart.updateEquip();
            this._equipPart.alpha = 1;
            this.updatePetItems();
            this.setSkillInfo();
            _window.contentTopOf3DSprite.addChild(this._rightInfo);
            this._leftBtn = UIFactory.gLoadedButton(ImagesConst.TurnLeft2_upSkin, 368, 390, 40, 36, this._equipPart);
            this._leftBtn.configEventListener(MouseEvent.MOUSE_DOWN, this.onClickTurnBtn);
            this._rightBtn = UIFactory.gLoadedButton(ImagesConst.TurnRight2_upSkin, 105, 390, 40, 36, this._equipPart);
            this._rightBtn.configEventListener(MouseEvent.MOUSE_DOWN, this.onClickTurnBtn);
            Global.stage.addEventListener(MouseEvent.MOUSE_UP, this.stopTurning);
            this.updateVip();
            isShowNow = true;
            return;
        }// end function

        private function init3DRect() : void
        {
            if (!this._rect3d)
            {
                this._rect3d = Rect3DManager.instance.registerWindow(true, new Rectangle(this._mx, this._my, this._wid, this._hei), _window);
                Rect3DManager.instance.windowShowHander(null, _window);
            }
            return;
        }// end function

        private function setTimeoutFun() : void
        {
            clearTimeout(this._timeoutNum);
            this.update3DPet(true);
            return;
        }// end function

        public function updatePetItems() : void
        {
            if (this._equipPart)
            {
                this._equipPart.updatePetItem();
                if (Cache.instance.newPet.pet)
                {
                    this._rightInfo.updateMsg(Cache.instance.newPet.pet);
                }
            }
            if (this._petSkillPart)
            {
                this._petSkillPart.updateSkillbook();
            }
            return;
        }// end function

        public function updatePetEquip() : void
        {
            if (this._equipPart)
            {
                this._equipPart.updateEquip();
                if (Cache.instance.newPet.pet)
                {
                    this._rightInfo.updateMsg(Cache.instance.newPet.pet);
                }
            }
            return;
        }// end function

        public function showBtnFilter() : void
        {
            if (this._rightInfo)
            {
                this._rightInfo.showBtnFilter();
            }
            return;
        }// end function

        public function shapeCardStatUpdate() : void
        {
            if (this._equipPart)
            {
                this._equipPart.shapeCardStatUpdate();
            }
            return;
        }// end function

    }
}
